package info.motteke.qjdbc.column.variable;

import java.sql.PreparedStatement;
import java.sql.SQLException;

public final class FloatVariable extends Variable {

    private float value;

    private boolean set = false;

    public FloatVariable() {

    }

    public FloatVariable(float value) {
        is(value);
    }

    public void is(float value) {
        this.value = value;
        set = true;
    }

    @Override
    void putValue(PreparedStatement pstmt, int index) throws SQLException {
        if(!set){
            throw new IllegalStateException();
        }
        pstmt.setFloat(index, value);
    }

}
